﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Web;

namespace HexagonWeb.IDAL
{
    public interface InterfaceBaseRepository<T>
    {
        IQueryable<T> Entities { get; }


        //添加
        T Add(T entity);

        //查询记录数
        int Count(Expression<Func<T, bool>> predicate);

        //更新
        bool Update(T entity);

        //删除
        bool Delete(T entity);

        //是否存在
        bool Exist(Expression<Func<T, bool>> anyLambda);

        //查询数据
        T Find(Expression<Func<T, bool>> whereLambda);

        //查找数据列表
        IQueryable<T> FindList(Expression<Func<T, bool>> whereLambda,
            string orderName, bool isAsc);

        //查找分页数据列表
        IQueryable<T> FindPageList(int pageIndex, int pageSize, out int totalRecord,
            Expression<Func<T, bool>> whereLambda, string orderName, bool isAsc);
    }
}